package org.bdware.doip.core.doipMessage;

public enum DoipResponseCode {
    Success("0.DOIP/Status.001"),
    Invalid("0.DOIP/Status.101"),
    UnAuth_Client("0.DOIP/Status.102"),
    UnAuth_Op("0.DOIP/Status.103"),
    DoNotFound("0.DOIP/Status.104"),
    DoAlreadyExist("0.DOIP/Status.105"),
    Declined("0.DOIP/Status.200"),
    TLSRequired("0.DOIP/Status.201"),
    MoreThanOneErrors("0.DOIP/Status.500"),
    UnKnownError("0.DOIP/Status.999");
    private final String name;

    DoipResponseCode(String displayName) {
        this.name = displayName;
    }

    public static DoipResponseCode getDoResponse(String respStr){
        for (DoipResponseCode resp : DoipResponseCode.values()) {
            if (resp.getName().equals(respStr)) {
                return resp;
            }
        }
        return DoipResponseCode.UnKnownError;
    }

    public String getName() {
        return name;
    }
}